//
//  NetWorkResponseSerializer.h
//  URLSessionTest
//
//  Created by mac on 2017/7/7.
//  Copyright © 2017年 yyb. All rights reserved.
//

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol NetWorkResponseSerialization <NSObject, NSSecureCoding, NSCopying>
- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response
                                    data:(nullable NSData *)data
                                   error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;
@end

@interface NetWorkResponseSerializer : NSObject

@end

@interface NetWorkHTTPResponseSerializer : NSObject <NetWorkResponseSerialization>
- (instancetype)init;
@property (nonatomic, assign) NSStringEncoding stringEncoding;
+ (instancetype)serializer;
@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;
@property (nonatomic, copy, nullable) NSSet <NSString *> *acceptableContentTypes;
- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response
                    data:(nullable NSData *)data
                   error:(NSError * _Nullable __autoreleasing *)error;
@end

@interface NetWorkJSONResponseSerializer : NetWorkHTTPResponseSerializer
- (instancetype)init;
@property (nonatomic, assign) NSJSONReadingOptions readingOptions;
@property (nonatomic, assign) BOOL removesKeysWithNullValues;
+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions;
@end

@interface NetWorkXMLParserResponseSerializer : NetWorkHTTPResponseSerializer

@end
NS_ASSUME_NONNULL_END
